The invention relates to a method for decoding a linear barcode in an image and in particular a method for decoding a linear barcode in an image consisting of pixels.
Symbols consisting of barcodes have become increasingly used to gather significant data from a plurality of different objects. Bar code symbologies of different types have developed over tune. The first symbologies developed such as, for example, RAN/UPC, code 128 and code 39, are called linear symbologies because the data of a symbol extend along a single axis or direction along a succession of black bars and white spaces. Recently, two-dimensional symbologies have also asserted themselves, such as, for example, Datamatrix, PDF-417 and others, that encode the data of a symbol on a two-dimensional surface.
In the past, but also still today, laser-scanning readers have been mainly used to read linear barcodes, in which a laser beam impinges on the code to be read and the light reflected therefrom is received by a device that is sensitive to the light and is converted into an analogue electric signal that constitutes the profile of the barcode. Alternatively to the laser-scanning readers, linear readers are also frequently used that are based on pixel technology, which comprise a sensor consisting of a single line of pixels. The luminous intensity that impinges upon each pixel during a scan is analysed and it is still possible to reconstruct a profile for the linear barcode from the discrete intensity values detected from each pixel, which enables the code to be decoded. If in fact the intensity values of each pixel are considered as sampled values of an analogue signal of the profile of the barcode, it is possible to identify the succession of black bars and white spaces and the width of each bar and/or space, reconstructing, by the well-known techniques of processing of sampled signals, the profile of the code.
A linear symbology normally use elements of two different widths for coding, such as, for example, a narrow and/or wide black bar and a narrow and/or wide space. It should be noted that a barcode element means indifferently a black bar or a white space.
Other linear symbologies use elements of 4 or more different widths and in this case the width of each element is a integral multiple of a minimum value. As a result, the greater the minimum width element inside the image is than the dimension of a pixel, the simpler decoding the barcode will be, the minimum width element also being known as a module.
From the theoretical point of view, according to what has been established by known sampling theory, it could be possible to decode the code with a reader the sensor of which has a resolution of at least one pixel per module. Nevertheless, the more pixels of a scanning line are impinged upon by a luminous intensity that refers to the same module, the more possible it will be to define in detail a transition from a black bar to a white space and vice versa and it will thus be possible to decode the code. For reading two-dimensional codes, readers have affirmed themselves that are based on two-dimensional image sensors i.e. in which a pixel matrix receives an image of the entire linear barcode. In this case, each line or column has a number of pixels that is less than that of a linear pixel sensor, but this does not represent a problem for reading a two-dimensional code.
However, increasingly frequently some applications require being able to read both linear symbols and two-dimensional symbols.
In order to meet this need, it is thus necessary to use readers provided with a two-dimensional sensor but, owing to the smaller number of pixels located on a line or a column, the depth of field and/or the minimum width of the module that can be read are worse that what is obtainable with a linear sensor provided with a greater number of pixels. In particular, the minimum width of the module that can be read with a two-dimensional sensor is greater than what is obtainable with a linear sensor.
Further, using two-dimensional image sensors with a limited number of pixels, is increasingly demanding because it is much cheaper and more widespread than using two-dimensional sensors with a great number of pixels.
If a two-dimensional sensor is used for reading a linear symbology, this symbology is decoded by selecting a determined line of the set of scanning lines, where each scanning line comprises a set of adjacent pixels of the two-dimensional pixel matrix of the sensor. Adjacent pixels are defined as pixels that have at least one side or vertex in common. For example, a horizontal row or a vertical column of the two-dimensional sensor can be considered to be scanning lines.
Similarly to what occurs with linear sensors, the luminous intensity that impinges upon each pixel of the scanning line is analysed to reconstruct a profile for the linear barcode that enable the code to be decoded.
As said previously, sampling theory sets a theoretical limit, i.e. requires the linear barcode to be acquired with a resolution of at least one pixel per module and no interpolation, filtering or oversampling process exists that, applied to a scanning line, enables this limit to be overcome.
For sensors with a low number of pixels, such as pixel matrix readers, if a module has a width that is less than the dimension of one pixel it is not possible to reconstruct the profile of the code and thus decode the linear barcode. Further, even when the above theoretical limit is complied with, if the resolution is greater than this limit by a few fractions, it is known experimentally that it is not possible to decode the linear barcode.
The object of the present invention is to provide a new method for decoding a linear barcode.
A further object is to provide a method for decoding a barcode that enables this decoding even if the information contained in any scanning line is not sufficient to identify all the transitions between the elements of the barcode owing to the insufficient resolution of the sensor.
As the limit set by the sampling theory remains valid also for the method that is the object of the present invention, a further object is to provide a decoding method that has a resolution that is greater than one pixel per module.
A further object is to provide a decoding method that is particularly fast from the computational point of view, i.e. that enables the time to be reduced that is required for decoding the code,
According to the invention a method is provided for decoding a barcode.
According to the invention a barcode reader is further provided.
According to the invention a programme is further provided.
Owing to the invention it is thus possible to obtain a method that enables a linear barcode to be decoded inasmuch as an oversampled signal is constructed, i.e. a virtual profile of the code with a subpixel resolution, owing to the use not only of the intensity values of pixels in a predetermined scanning line but also of further pixels, that do not belong to the predetermined scanning line. In other words, as no scanning line exists that permits decoding in the event of resolution that is too low, information is used that is present in the linear barcode but is displaced with respect to the scanning line, to increase the number of samples with which to reconstruct the profile.
Further pixels are thus added to the pixels of the predetermined scanning line.
In this manner, the limit set by the sampling theorem is overcome and a barcode can be decoded even when the resolution is less than one pixel per module. As a result barcode readers can be advantageously used that integrate two-dimensional sensors that nevertheless at the same time ensure great flexibility both for reading linear symbols and reading two-dimensional symbols.
As a result, to an even greater extent, barcode readers can be made that integrate cheap linear sensors, it always being possible to decode a linear barcode even when the resolution is less than one pixel per module.